import request from '@/utils/request'
import type { ILoginForm, IUserInfo } from '@/types'

interface LoginResponse {
  token: string
}

export const login = (data: ILoginForm): Promise<LoginResponse> => {
  return request.post('/api/login', data)
}

export function getUserInfo() {
  return request({
    url: '/auth/info',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/auth/logout',
    method: 'post'
  })
}